#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
/*
bool canJump(int A[], int n) {
    if(n<1)
        return false;
    if(n == 1)
        return true;

    int *pre, *status;
    pre = (int*)malloc(sizeof(int)*n);
    status = (int*)malloc(sizeof(int)*n);

    int cur = 0;
    int step = 0;
    
    for (int i = 0; i < n; ++i)
    {
        status[i] = A[i];
    }
    // 0 for this step is no use.
    while(status[0] > 0)
    {
        if (status[cur] == 0 && cur < (n -1))
        {
            cur -= pre[cur];
            status[cur]--;
        }
        else 
        {
            step = status[cur];
            cur += step;
            if (cur >= n - 1)
            {
                break;
            }
            pre[cur] = step;
        }
    

    free(pre);
    free(status);

    if (cur>= (n - 1))
    {
        return true;
    }
    return false;       
}
bool canJump(int A[], int n) {
    if(n<1)
        return false;
    if(n == 1)
        return true    int cur = 0;
    int step = 0;

    while(A[0] > 0 && cur < (n-1))
    {
        if (A[cur] == 0)
        {
            cur--;
            if (A[cur])
            {
                A[cur]--;
            } 
        }
        else 
        {
            step = A[cur];
            cur += step;;

        }
    }

    if (cur >= (n-1))
    {
        return true;
    }
    return false;

}
*/
bool canJump(int A[], int n) 
{
    int* status = new int[n];

    status[0] = A[0];
    if(status[0]==0 && n>1) 
    {
        return false;
    }

    for(int i=1;i<n;i++)
    {
        status[i] = std::max(status[i-1],A[i] + i);
        //can not reach the next node
        if( status[i]<=i && i!=n-1 ) 
        {
            delete[] status;
            return false;
        }
        // this has satisfy the condition.
        if (status[i] >= (n - 1))
        {
            break;
        }
    }
    delete[] status;
    return true;

}
int main(int argc, char const *argv[])
{
    int A[30];
    int n;
    int i;
    int testnumber;
    scanf("%d", &testnumber);
    while(testnumber--)
    {
        scanf("%d", &n);
        for (i = 0; i < n; ++i)
        {
            scanf("%d", A+i);
        }
        printf("%d\n", canJump(A, n));
    }
    return 0;
}